import java.util.Arrays;
import java.util.Comparator;
import java.util.List;

/**
 * @author sjw
 * @className TestStream
 * @date 2021/8/21 17:19
 * @description: TODO
 */
public class TestStream {
    static class User{
        String name;
        Integer age;

        public User(String name,Integer age){
            this.name=name;
            this.age   =age;
        }

        public Integer getAge() {
            return age;
        }
    }

    public static void main(String[] args) {
        List<User> users= Arrays.asList(
          new User("a",12),  new User("b",16),new User("c",14)
                );


       int a= users.stream().map(User::getAge).max(Comparator.comparing(Integer::intValue)).get();

        System.out.println(a);

    }

}
